Hi there,
DB theDiag = null
// Now override block and show, to only do realize
void show (DB x) { realize x; theDiag = x }
void block (DB x) { realize x; theDiag = x }
if (null current Module) {
print "You need to have a current Module set for the export."
halt
}
// now include the word.dxl -> this will pop up the dialog, but not halt execution
// due to the overrides above
#include <standard/export/office/word.dxl>
// here we can change the dialog options. See itfui2.inc and word.dxl for all
// the options
set(exportHeadingsToggle, false) // turn off export of headings
string Template_Path = (getenv("Home")) "\\lib\\word\\my_template.dot"
set(advancedNormalTemplateToggle, false)
set(advancedTemplateName, Template_Path)
// now manually launch the export button callback
doExport theDiag
// add/modify document properties
// See: http://www.ibm.com/developerworks/wikis/x/iwCPBQ
checkRes(oleGet (objWord, cPropertyActiveDocument, objDoc))
checkRes(oleGet (objDoc, cPropertyCustomDocumentProperties, objCustomProperties))
peter_schaefer - Thu Mar 22 06:43:22 EDT 2012 |
Re: Access the Word Object from word.dxl Seems to me you need to re-establish the link to MS-Word, first simply try to "createWordApplication()" again; but you may also need this:
-Louie |
Re: Access the Word Object from word.dxl llandale - Thu Mar 22 12:33:37 EDT 2012
-Louie
Thanks Louie, that put me on the right track.
// Need OLE argument block
objArgBlock = create
// (Re-)attach to existing word application
objWord = oleGetAutoObject(cObjWordApplication)
// Get Active Document
checkRes(oleGet (objWord, cPropertyActiveDocument, objDoc))
// Get CustomProperties Collection
checkRes(oleGet (objDoc, cPropertyCustomDocumentProperties, objCustomProperties))
int nPropCount
int nPropNumber
string strName
oleGet(objCustomProperties, "Count", nPropCount)
for (nPropNumber = 1; nPropNumber <= nPropCount; nPropNumber++) {
clear objArgBlock
put(objArgBlock, nPropNumber)
oleGet(objCustomProperties, cMethodItem, objArgBlock, objProperty)
checkRes(oleGet(objProperty, "Name", strName))
print "Property " nPropCount " is called " strName
}
|